USE [DSRSystem]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spGetFinalizedCompanies]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spGetFinalizedCompanies]
GO

CREATE PROCEDURE [dbo].[spGetFinalizedCompanies]
AS
BEGIN
	SELECT  Companies.CompanyId, 
			Companies.Name AS CompanyName,
			Companies.CIQID AS CapitalIQID,
			Companies.FinalAnalystCommentary AS AnalystCommentary,
			Companies.LastCorporateDataUpdate, 
			Companies.LastFinalUpdate, 
			Companies.LastCentralizedResearchUpdate
	FROM    [dbo].Companies AS Companies	
	WHERE	(Companies.WorkingVersion > 1002) 
	AND (Companies.IsParked = 0)
	AND (Companies.IsControversyResearchOnly = 0)
END

GO


